
D_MSLOG_LIBS :=`pkg-config --libs libmslog`
D_MSLOG_INCLUDES :=`pkg-config --cflags libmslog`
D_MSCOMMON_LIBS :=`pkg-config --libs libmscommon`
D_MSCOMMON_INCLUDES :=`pkg-config --cflags libmscommon`
C_INCLUDE=${D_BASEAPI_FLAGS} -Isrc -Isrc/denc ${D_MSLOG_INCLUDES}
C_LIBS=${D_MSLOG_LIBS} -pthread  -lm
libmscommon_CC=${CC}
libmscommon_SRC=${C_SRC}
libmscommon_CFLAGS=${C_INCLUDE} ${C_LIBS} ${CFLAGS_SHARE} -DOS_LINUX_SOC -DOS_LINUX_X64 

msfifo_api_sample_CC=${CC}
msfifo_api_sample_SRC=msfifo_api_sample.c
msfifo_api_sample_CFLAGS=${C_LIBS} ${D_MSCOMMON_INCLUDES} ${D_MSCOMMON_LIBS} 

msmem_api_sample_CC=${CC}
msmem_api_sample_SRC=msmem_api_sample.c
msmem_api_sample_CFLAGS=${C_LIBS} ${D_MSCOMMON_INCLUDES} ${D_MSCOMMON_LIBS} 

msmd5_tools_CC=${CC}
msmd5_tools_SRC=msmd5_tools.c
msmd5_tools_CFLAGS=${C_LIBS} ${D_MSCOMMON_INCLUDES} ${D_MSCOMMON_LIBS}  -DOS_LINUX_SOC

DBG_FLAG=-g -rdynamic

x8664:    libmscommon     install
x8664_gdb:libmscommon_gdb install

libmscommon: 
	mkdir -p $(OUT_LIB)
	mkdir -p $(OUT_INCLUDE)
	cp -fr src/*.h src/denc/*.h $(OUT_INCLUDE)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS)  -o $(OUT_LIB)/$(PROGRAM_NAME).so 
libmscommon_gdb: 
	mkdir -p $(OUT_LIB)
	mkdir -p $(OUT_INCLUDE)
	cp -fr src/*.h src/denc/*.h $(OUT_INCLUDE)
	$(libmscommon_CC)  $(libmscommon_SRC)  $(libmscommon_CFLAGS) ${DBG_FLAG} -o $(OUT_LIB)/$(PROGRAM_NAME).so  

sample:msfifo_api_sample msmem_api_sample msmd5_tools
msfifo_api_sample: 
	mkdir -p $(OUT_BIN)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS) ${DBG_FLAG} -o $(OUT_BIN)/$@ 
msmem_api_sample: 
	mkdir -p $(OUT_BIN)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS) ${DBG_FLAG} -o $(OUT_BIN)/$@ 
msmd5_tools: 
	mkdir -p $(OUT_BIN)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS) ${DBG_FLAG} -o $(OUT_BIN)/$@ 	

install:
	mkdir -p  ${prefix_x8664}/lib/ 
	mkdir -p  ${prefix_x8664}/include/   
	mkdir -p  ${prefix_x8664}/lib/pkgconfig/ 
	cp -fr $(OUT_LIB)/$(PROGRAM_NAME).so	${prefix_x8664}/lib/     
	cp -fr $(OUT_INCLUDE)			${prefix_x8664}/include/	     
	cp -fr platform/$(PROGRAM_NAME).pc	${prefix_x8664}/lib/pkgconfig/
uninstall:
	rm -fr ${prefix_x8664}/lib/$(PROGRAM_NAME).so 
	rm -fr ${prefix_x8664}/include/$(PROGRAM_NAME)
	rm -fr ${prefix_x8664}/lib/pkgconfig/$(PROGRAM_NAME).pc
